import request from '.'

// 列表
export function getNotes<T>(page: number, size: number) {
  return request.get<T>('/api/test/test', { params: { page, size } }) as Promise<T>
}

// 添加笔记
export function addNotes<T>(note: T) {
  return request.post<T>('/api/add', note)
}

// 更新笔记
export function updateNotes<T>(id:string, note: T) {
  return request.post<T>('/api/update', {id:id, note:note}) as Promise<T>
}

// 搜索笔记
export function getNotesListByContent<T>(content: string) {
  return request.get<T>('/api/test/test', {params : {content : content}}) as Promise<T>
}

// 笔记详情
export function getNoteById<T>(id:string) {
  return request.get<T>(`/api/test/${id}`) as Promise<T>
}

//  删除笔记
export function deleteNoteById<T>(id:string) {
  return request.post<T>('/api/delete', {id:id}) as Promise<T>
}